package com.hjxy.codetools.service;

import com.hjxy.codetools.dao.ArtitleMapper;
import com.hjxy.codetools.interfa.ArtitleServiceInterface;
import com.hjxy.codetools.model.ArtitleModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;
@Service
@Transactional(isolation = Isolation.DEFAULT,propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
public class ArtitleService implements ArtitleServiceInterface {

    @Autowired
    ArtitleMapper artitleMapper;

    @Override
    public List<ArtitleModel> getArtitlesInfo(Map whMap) throws Exception {
        return artitleMapper.getArtitlesInfo(whMap);
    }

    @Override
    public List<ArtitleModel> getAllArtitlesInfo() throws Exception {
        return artitleMapper.getAllArtitlesInfo();
    }

    @Override
    public List<ArtitleModel> TypeArtitles(Map whMap) throws Exception {
        return artitleMapper.TypeArtitles(whMap);
    }

    @Override
    public List<ArtitleModel> searchArticles(String searchkey) throws Exception {
        return artitleMapper.searchArticles(searchkey);
    }


    @Override
    public List<ArtitleModel> ArtitlesInfo(Map whMap) throws Exception {
        return artitleMapper.ArtitlesInfo(whMap);
    }

    @Override
    public int getTotalNum(Map map) throws Exception {
        return artitleMapper.getTotalNum(map);
    }

    @Override
    public int insertArtitle(ArtitleModel artitleModel) throws Exception {
        return artitleMapper.insertArtitle(artitleModel);
    }

    @Override
    public int updateArtitle(ArtitleModel artitleModel) throws Exception {
        return artitleMapper.updateArtitle(artitleModel);
    }

    @Override
    public int deleteArtitle(int[] params) throws Exception {
        return artitleMapper.deleteArtitle(params);
    }

    @Override
    public ArtitleModel getArtitleByCode(String fcode) throws Exception {
        return artitleMapper.getArtitleByCode(fcode);
    }

    @Override
    public List<ArtitleModel> getArtitlePreNext(int fcode) throws Exception {
        return artitleMapper.getArtitlePreNext(fcode);
    }

    @Override
    public ArtitleModel getArtitleById(int id) throws Exception {
        return artitleMapper.getArtitleById(id);
    }

}
